{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7d0d179d",
   "metadata": {},
   "source": [
    "# THE CODE IS IN MY GITHUB!!!\n",
    "Go and checkout my github if you want the to_candle file!\n",
    "## https://github.com/kecoma1/Trading_BOT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "dc133857",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import to_candle"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f1c665d2",
   "metadata": {},
   "source": [
    "## Candle dataframe\n",
    "This dataframe is obtained through the from_tick_to_candle function. The dataframe contains the following columns:\n",
    "* **TIME-UTC**: UTC-TIME since epoch in seconds.\n",
    "* **OPEN**: Open price of that candle.\n",
    "* **CLOSE**: Close price of the candle.\n",
    "* **HIGH**: Highest price of the candle.\n",
    "* **LOW**: Lowest price of the candle."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "794baf27",
   "metadata": {},
   "outputs": [],
   "source": [
    "candle_df = to_candle.from_tick_to_candle(\"EURUSD.csv\", 15*60)\n",
    "candle_df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ea75aa13",
   "metadata": {},
   "outputs": [],
   "source": [
    "del candle_df[\"TIME-UTC\"]\n",
    "candle_df.plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1bf5fd6c",
   "metadata": {},
   "source": [
    "## Technical analysis library - ta.trend.EMAIndicator\n",
    "**pip install ta**\n",
    "\n",
    "Using the *ta* library we are going to load the RSI information of the current dataframe using the *close column*."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a6b946a2",
   "metadata": {},
   "outputs": [],
   "source": [
    "from ta.trend import EMAIndicator\n",
    "ema_object =EMAIndicator(candle_df[\"CLOSE\"], window=9, fillna=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b1371837",
   "metadata": {},
   "source": [
    "Computing the EMA value.\n",
    "\n",
    "### EMA values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "96b14e45",
   "metadata": {},
   "outputs": [],
   "source": [
    "ema = ema_object.ema_indicator()\n",
    "ema.tail(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0920ec80",
   "metadata": {},
   "source": [
    "# EMA PLOT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "98396333",
   "metadata": {},
   "outputs": [],
   "source": [
    "ema.plot(figsize=(20, 10))"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "b3ba2566441a7c06988d0923437866b63cedc61552a5af99d1f4fb67d367b25f"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
